<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    let person = {
        name: '张三',
        age: 18
    }

    let p = {}

    Object.defineProperty(p, 'name', {
        configurable: true,
        get() {
            return person.name
        },
        set(value) {
            console.log('有人修改了name属性，我发现了，我要去更新界面！')
            person.name = value
        }
    })

    Object.defineProperty(p, 'age', {
        configurable: true,
        get() {
            return person.age
        },
        set(value) {
            console.log('有人修改了age属性，我发现了，我要去更新界面！')
            person.age = value
        }
    })
</script>
</body>
</html>